Alessandro Levi Montalcini
C.so Re Umberto 10
10121 Torino
Italy
e-mail: alm@torino.alpcom.it
ftp://ftp.alpcom.it/software/mac/LMontalcini
ftp://ftp.alpcom.it/software/mac/LMontalcini/html/alm_home.html

 

CalConvert 2.2 documentation - December 1995

• Shareware: $5
◊  This utility is distributed as shareware: if you like it please honor the shareware system by sending $5 to the author at the address above. Since cashing international cheques is very expensive, please send cash only (U.S. dollars are best, but any other currency is fine).
◊  If you work on the Macintosh, there are many things you can send me instead of the money. Here are some suggestions: original software (but don’t send any shareware/freeware unless you’re the author), books or computer-related magazines (any free issue or subscription is welcome), CD-ROMs, any piece of new or used hardware, or anything else you’ve created.
◊  There’s still another thing you could do: I’ll finish my physics studies sometime in 1996 and I’m looking for a one-year job as a programmer (or maybe a scientist?) outside of Italy. Let me know if you have anything to offer.
◊  If you can’t afford any of the above an e-mail, a postcard or a letter is welcome. I speak English, French and Italian. Please forgive me if I don’t answer to all of your letters - I am often overloaded with my school work.

• Introduction
◊  CalConvert is a small shareware utility that does integer arithmetic calculations and converts integer values to different bases (decimal, hexadecimal, binary, octal or any custom base between 2 and 32) or to an OSType (a sequence of four ASCII characters). The conversion may be signed or unsigned (you can always enter a signed value, it gets converted to unsigned if needed); the result may be interpreted either as a word (2 bytes) or as a long word (4 bytes). Version 2.0 sports a new clickable bit field display for easy bit-by-bit manipulations. The Return and Enter keys start the conversion; Tab, shift-Tab and the four arrow keys have their usual meanings.

• Configuration
◊  Choosing the “Fields” item from the “Options” menu brings up a configuration dialog that can be used to fully customize CalConvert. CalConvert can show up to 8 fields; each field contains either a mathematical expression, a sequence of 1 to 4 characters (OSType) or an integer number in any base from 2 to 32.
◊  Version 2.0 comes with Font and Size menus that can be used to change the window’s look and size.

• The calculator
◊  You may enter mathematical or logical expressions in fields labeled “Math”, i.e. things like “(12*(128-$20))<<2+2^8”; the result is shown in all the other fields of the window when you press Return or Enter or click the “=” button. If the expression can’t be parsed correctly, CalConvert beeps and all other fields are set to zero. The next paragraphs explain the syntax and operators you may use in your mathematical expressions.

• Syntax of the math field
◊  xxx (x=0-9) is a number
◊  $xxx (x=0-9,A-F) is an hexadecimal number
◊  -xxx, -$xxx, $-xxx are negative numbers
◊  '(' and ')' can be used as usual, nesting allowed
◊  spaces are allowed between numbers and operators
◊  no spaces are allowed inside numbers or operators
◊  all numbers are interpreted as 32-bit signed integers

• Order of operators
◊  Operators in the upper lines are calculated first.
◊  Operators in the same line are calculated sequentially.

   ^   **
   *   /   :   %   <<  >>
   &   |   \   AND OR  XOR
   +   -
   =   ==  !=  <>  <   >   <=  >=

• Arithmetic operators

  +     add
  -     subtract
  *     multiply
  /     divide
  :     divide
  %     remainder
  ^     power
  **    power

• Logical operators
    (return 1 if true, 0 if false)

  =     equal to
  ==    equal to
  !=    not equal to
  <>    not equal to
  <     less than
  >     greater than
  <=    less or equal
  >=    greater or equal

• Bitwise operators

  <<    bit shift left
  >>    bit shift right
  &     bit and
  AND   bit and
  and   bit and
  |     bit or
  OR    bit or
  or    bit or
  \     exclusive or
  XOR   exclusive or
  xor   exclusive or

• Version history
◊  2.2 - Fixed a bug in the parser that caused bad prioritization of the operators for some complex expressions that didn’t use parenthesis (thanks to Paolo Sasso for finding out the problem).
◊  2.1 - Uses the color utilities pattern as a background pattern under System 7.5 or later. You can set the utilities pattern by holding down the option key inside System 7.5’s Desktop Patterns utility.
◊  2.0 - Added a clickable bit-by-bit representation, font and size menus, “long word” and “unsigned” check boxes and an “evaluate” button; most of the interface code was rewritten to make the CalConvert window a configurable stand-alone code module.
◊  1.2.3 - CalConvert now refuses exponents larger than 32.
◊  1.2.2 - Made the fields dialog movable.
◊  1.2.1 - Cleaned up the code and updated documentation.
◊  1.2 - Recompiled as a fat binary, runs native on Power Macs.
◊  1.1 - Removed System 7 dependance and custom window definition.
◊  1.06 - Added online help, changed menu keys to follow Apple guidelines.
◊  1.05 - Fixed incoherent behavior of the “Fields” dialog.
◊  1.04 - Changed name to CalConvert.
◊  1.03 - First shareware version with arithmetic parser.
◊  1.02 - First public release as QuickConvert.
◊  1.01 - Menus added, still looks like a quick hack.
◊  1.0 - Written for my personal use only, very poor interface.

• Distribution
◊  CalConvert is ©1994-95 Alessandro Levi Montalcini. It can be freely distributed as long as it is not modified and there’s no charge for it, but it may not be included in any commercial package without my consent.
◊  You may find the latest version of all my shareware programs by anonymous ftp to ftp.alpcom.it, inside the /software/mac/LMontalcini directory. The complete ShareDisk package, which contains all my stuff and can be registered at a very low price, is also available there.
◊  All online services and bulletin boards may make it available to their users at no charge other than the normal connection fees.
◊  All non-profit user groups may distribute it at no charge.
◊  All magazines may publish it on floppy disk without asking me first, as long as I get a copy of the issue containing my software.
◊  All CD-ROM shareware collections and CD-ROM magazines may include it without my prior consent, as long as I get either a copy of the CD-ROM or an offer to buy the CD-ROM at a discounted price.
◊  All redistribution companies such as Educorp may distribute it, as long as I get a copy of each media containing my software and a catalog of the company’s offerings (where applicable).

• Disclaimer
◊  CalConvert shouldn’t cause any damage, but you’re using it at your own risk. As an independent software developer, I can make no warranties whatsoever on it.

• Have fun!
◊  And don’t forget to $$$ send your contribution $$$ so that more cool utilities will see the light in the near future, at the low-low-low costs of shareware.